/*
 * @Author: wangqizhang
 * @Date: 2024-05-04 14:02:46
 * @LastEditors: wangqizhang
 * @LastEditTime: 2024-05-05 11:53:27
 * @FilePath: /suixinji-server/router/note.router.js
 * @Description:
 *
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
 */
const Router = require('koa-router');
const router = new Router({ prefix: '/note' });
const { validateToken, validBodyData } = require('../middleWare');
const {
  getNoteList,
  createNote,
  getNoteDataByGroupId,
  updateNote,
  getDefaultNote,
} = require('../controller/note.controller');
const { noteParams } = require('../model/note.model');
router.get('/', (ctx, next) => {
  console.log(ctx);
});
router.get('/noteList', validateToken, getNoteList);
router.get('/getNoteById', validateToken);
router.get('/getNoteByGroupId', validateToken, getNoteDataByGroupId);
router.post('/edit', validBodyData, validateToken, updateNote);
router.post(
  '/add',
  (ctx, next) => validBodyData(ctx, next, noteParams),
  validateToken,
  createNote
);
router.get('/defaultGroup', validateToken, getDefaultNote);
module.exports = router;
